﻿using NH.Beng.Repository;
using ShopEnzi.Data.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ShopEnzi.Data.Entities
{
    public partial class Category
    {
        public static Category GetCategoryByName(string name, CategoryType type, UnitOfWork uow)
        {
            var categoryRepo = Category.GetRepository(uow);
            Category returnCategory = null;
            returnCategory = categoryRepo.Linq().FirstOrDefault(q => q.Name.Trim() == name.Trim() && q.Type == type);
            return returnCategory;
        }
    }
}
